package org.zsl.ssm.service;

import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.zsl.ssm.mapper.UserMapper;
import org.zsl.ssm.mapper.wrapper.UserMapperWrapper;
import org.zsl.ssm.model.User;
import org.zsl.ssm.util.MybatisFactory;

import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;

/**
 *  向spring容器注册一个javabean
 * */
@Service
public class UserService {


     /**
     *   userMapper的包装类
     * */
      @Autowired
      private UserMapper mapper;




  /*  @Autowired
    private UserMapper mapper;*/
    /**
     *  耦合
     *     mybatis 的相关内容 和 service 耦合度过高！！！
     *     ioc ,aop
     *
     *      程序员首要职责
     *
     * */
    public List<User> getAllUsers() throws IOException {

        /**
         *  逻辑运算
         *    不会处理数据访问相关的细节
         * */

        return mapper.selectAll();

    }
}
